package com.itheima.udp5;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class JieshouClient {

    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket(8888);
        byte[] bytes = new byte[1024 * 64];
        while (true) {
            DatagramPacket dp = new DatagramPacket(bytes,bytes.length);
            ds.receive(dp);
            InetAddress address = dp.getAddress();
            String name = address.getHostName();
            String ip = address.getHostAddress();
            String s = new String(bytes, 0, dp.getLength());
            System.out.println(ip+"===="+name+"%%%"+s);
        }


    }
}
